added ability to set grid authorization type field to CurationTask#1392
Open
andrewelamb wants to merge 19 commits into
Open
added ability to set grid authorization type field to CurationTask#1392andrewelamb wants to merge 19 commits into
andrewelamb wants to merge 19 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Curation grid sessions could only be created with the default authorization behavior, where the user who creates the session becomes its owner (
SESSION_OWNER). There was no way to:CurationTaskto recommend a particular authorization mode for the grid sessions opened against it.Gridsession withSOURCE_BENEFACTORauthorization, which lets anyone with EDIT permission on the source data collaborate in the same session without being added to a shared ownership team.The affected code is the curation/grid model layer (
synapseclient/models/curation.py) and the curator extension task helpers, which previously had no concept of an authorization mode.Solution:
Added support for the grid
authorizationModefield throughout the curation/grid models:AuthorizationModeenum (SESSION_OWNER,SOURCE_BENEFACTOR) mirroring the Synapse RESTAuthorizationModetype, exported fromsynapseclient.models.suggested_authorization_modefield (plus the not-yet-activecollaborator_principal_ids) toFileBasedMetadataTaskPropertiesandRecordBasedMetadataTaskProperties.authorization_modefield toGridandCreateGridRequest, and wired it throughcreate_async/to_synapse_requestso it is sent at session-creation time and populated back from the response.CurationTaskcreates a new grid session, it now forwardstask_properties.suggested_authorization_modeto theGrid.file_based_metadata_task.py,record_based_metadata_task.py) accept and pass through the suggested authorization mode.Design notes / side effects:
to_synapse_requestfor the task properties was switched to build a full dict and then stripNonekeys viadelete_none_keys, instead of conditionally adding keys.owner_principal_idis now coerced tointwhen populated from API responses, fixing a type inconsistency.Testing:
CurationTaskpasses the correct authorization parameters when creating a grid session, and that the task properties / grid serialize and deserializeauthorizationModecorrectly (tests/unit/synapseclient/models/async/unit_test_curation_async.py,tests/unit/synapseclient/extensions/unit_test_curator.py).tests/integration/.../models/async/test_grid_async.py,test_curation_async.py).